package cn.wolfcode.mq;

/**
 * @ClassName OrderTimeOutMQConsumer
 * @Author VCR
 * @Date 2022/1/3 19:33
 * @Version 1.0
 */

import cn.wolfcode.service.IOrderInfoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 订单超时MQ
 */
@Component
@Slf4j
@RocketMQMessageListener(topic = MQConstant.ORDER_PAY_TIMEOUT_TOPIC, consumerGroup = "OrderTimeOutMQConsumer")
public class OrderTimeOutMQConsumer implements RocketMQListener<OrderMQResult> {

    @Autowired
    private IOrderInfoService orderInfoService;     // 注入订单Service实现超时取消

    @Override
    public void onMessage(OrderMQResult orderMQResult) {
        log.info("进入到超时取消MQConsumer中");
        orderInfoService.timeOutcancel(orderMQResult);

    }
}
